04. Lesson 3 Exercise
Lesson 3 Exercise
Overview
ND213 C04 L03 C3.4-Atom 1
Details
ND213 C04 L03 C3-4-A2
Project Tasks
Task L3.1 : In class
WaitingVehicles
, safeguard all accesses to the private members_vehicles
and_promises
with an appropriate locking mechanism, that will not cause a deadlock situation where access to the resources is accidentally blocked.Task L2.2 : Add a static mutex to the base class
TrafficObject
(called_mtxCout
) and properly instantiate it in the source file. This mutex will be used in the next task to protect standard-out.Task L2.3 : In method
Intersection::addVehicleToQueue
and inVehicle::drive()
ensure that the text output locks the console as a shared resource. Use the mutex_mtxCout
you have added to the base classTrafficObject
in the previous task. Make sure that in between the two calls tostd::cout
at the beginning and at the end ofaddVehicleToQueue
the lock is not held.
Workspace
This section contains either a workspace (it can be a Jupyter Notebook workspace or an online code editor work space, etc.) and it cannot be automatically downloaded to be generated here. Please access the classroom with your account and manually download the workspace to your local machine. Note that for some courses, Udacity upload the workspace files onto https://github.com/udacity, so you may be able to download them there.
Workspace Information:
- Default file path:
- Workspace type: react
- Opened files (when workspace is loaded): n/a
-
userCode:
export CXX=g++-7